package com.sure.yyr.info.customer;

import com.sure.yyr.common.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/info/customer")
public class CustomerAPI {

    @Resource
    private CustomerService customerService;

    @GetMapping("")
    public Result customerList(CustomerDto dto){
        Map<String,Object> page =  customerService.getCustomerList(dto);
        return Result.success(page);
    }

    @PostMapping("")
    public Result customerAdd(@RequestBody CustomerDto dto){
        customerService.addCustomer(dto);
        return Result.success();
    }
    @DeleteMapping("/{id}")
    public Result customerDelete(@PathVariable Integer id){
        customerService.deleteCustomer(id);
        return Result.success();
    }



}
